package com.empsys.old.aspects;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author wzm
 * @create 2023-12-16 16:17
 * project_name:web2310
 * @Description
 */
//通过使用注解的切入点表达式来增强
//@Aspect
//@Component
@Slf4j
public class AnnoAspect {

    //抽取切入点方法
    @Pointcut("@annotation(com.empsys.old.anno.MyAsp)")
    private void pt(){};

//    @Before("@annotation(com.empsys.anno.MyAsp)")
    @Before("pt()")
    public void before(){
        log.info("注解前置增强....");
    }

    @After("pt())")
    public void after(JoinPoint joinPoint){
        log.info("注解后置增强....");
    }

}
